Word Ladder II
1 | Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that: |
无向图 —-> 树 考虑 BFS树 —–> 求出所有的结果 考虑 DFS
解法一
1 | public List<List<String>> findLadders(String start, String end, Set<String> dict) { |
解法二:
1 | public List<List<String>> findLadders2(String beginWord, String endWord, List<String> wordList) { |